﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static H.Utils.NativeMethods;

namespace H.Utils
{
    /// <summary>
    /// 输入法相关工具类(用于切换不同的输入法)
    /// </summary>
    public static class InputMethodUtil
    {
        /// <summary>
        /// 切换系统语言为英文
        /// </summary>
        public static void ChangeAsEN_US()
        {
            PostMessage(HWND_BROADCAST, WM_INPUTLANGCHANGEREQUEST, IntPtr.Zero, LoadKeyboardLayout(EN_US, KLF_ACTIVATE));
        }

        /// <summary>
        /// 切换系统语言为中文
        /// </summary>
        public static void ChangeAsCN_ZH()
        {
            PostMessage(HWND_BROADCAST, WM_INPUTLANGCHANGEREQUEST, IntPtr.Zero, LoadKeyboardLayout(CN_ZH, KLF_ACTIVATE));
        }

    }
}
